import { Injectable} from "@angular/core";
import { LoggerService} from "./logger.service";

@Injectable()
export class ProductService {

  // Service要注入Service时候，要上层的提供器存在改Service时候才能注入，不像component，拥有注入器
    constructor(public logger: LoggerService) {}

    getProduct(): Product {
        this.logger.log("getProduct被调用");
        return new Product(0, "iphone", 5899, "新款苹果手机");
    }
}

export class Product {

    constructor(
        public id: number,
        public title: string,
        public price: number,
        public desc: string
    ) {}
}
